﻿using UnityEngine;
using System.Collections;

public class MoveLineScript : MonoBehaviour {

	GameObject[] waypoints;
	
	void Start(){
		int children = transform.childCount;
		waypoints = new GameObject[children];
		for (int i = 0; i < children; ++i) {
			GameObject wp = transform.GetChild(i).gameObject;
			WaypointScript wpScript = (WaypointScript) wp.GetComponent("WaypointScript");
			waypoints[wpScript.order] = wp;
		}
	}
	
	public Vector3 getStep(int i){
		return waypoints [i%waypoints.Length].transform.position;
	}
}
